package com.ljm.sys.auth.service.impl;

import com.ljm.security.dto.SecurityResRule;
import com.ljm.sys.auth.dto.AuthoritiesDto;
import com.ljm.sys.auth.entity.SysAuthRoleResource;
import com.ljm.sys.auth.mapper.SysAuthRoleResourceMapper;
import com.ljm.sys.auth.service.ISysAuthRoleResourceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ljm.sys.auth.api.SysAuthRoleResourceApi;
import com.ljm.sys.auth.dto.SysAuthRoleResourceDto;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * <p>
    * 角色权限 服务实现类
    * </p>
 *
 * @author HuamingChen
 * @since 2020-06-11
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysAuthRoleResourceServiceImpl extends ServiceImpl<SysAuthRoleResourceMapper, SysAuthRoleResource>
        implements ISysAuthRoleResourceService, SysAuthRoleResourceApi {
    @Resource
    private SysAuthRoleResourceMapper sysAuthRoleResourceMapper;
    @Override
    public Set<AuthoritiesDto> getAuthorites(String userId) {
        return sysAuthRoleResourceMapper.getAuthorites(userId);
    }

    @Override
    public Set<String> getPermission(String userId) {
        return sysAuthRoleResourceMapper.getPermission(userId);
    }

    @Override
    public Set<String> getPermissionForFront(String userId) {
        return sysAuthRoleResourceMapper.getPermissionForFront(userId);
    }
}
